/**
 *
 */
package gwc;

import java.util.Set;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * @author trung
 *
 */
public class GwcSessionListener implements HttpSessionListener {

	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
	 */
	public void sessionCreated(HttpSessionEvent arg0) {
		// do nothing
	}

	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
	 */
	public void sessionDestroyed(HttpSessionEvent arg0) {
		Set<Object> connectedUsers = (Set<Object>) arg0.getSession().getServletContext().getAttribute("connectedUsers");
		connectedUsers.remove(arg0.getSession().getAttribute("user"));
	}

}
